from time import *

with open('m1_sorted.txt') as b:
    a = []
    for i in b:
        a.append(int(i.strip()))


def bubbles(array):
    for i in range(len(a) - 1):
        flag = False
        for j in range(len(a) - i - 1):
            if a[j] > a[j + 1]:
                n = a[j]
                a[j] = a[j + 1]
                a[j + 1] = n
                flag = True
        if flag == False:
            break
    return a


start = time()
print(bubbles(a))
finish = time()
print('m1_sorted', round((finish - start) * 1000), 'milliseconds')

from time import *

with open('m2_reverse.txt') as b:
    a = []
    for i in b:
        a.append(int(i.strip()))

start = time()
print(bubbles(a))
finish = time()
print('m2_reverse', round((finish - start) * 1000), 'milliseconds')

from time import *

with open('m3_shuffle.txt') as b:
    a = []
    for i in b:
        a.append(int(i.strip()))

start = time()
print(bubbles(a))
finish = time()
print('m3_shuffle', round((finish - start) * 1000), 'milliseconds')
